<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
Cookie cr[]=request.getCookies();
Integer count=null;
for(int i=0;cr!=null&&i<cr.length;i++){
	if(cr[i].getName().equals("visitnum")){
		count=Integer.parseInt(cr[i].getValue());
		break;
	}
}
if(count==null){
	count=0;
}
count++;
Cookie c=new Cookie("visitnum",String.valueOf(count));
c.setMaxAge(86400);
response.addCookie(c);
%>
您访问了<%=count %>次
</body>
</html>